package org.odroid.server.fs; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class FileSystemUtils { public static File createDir(String path, String dir) { File f = new File(path, dir); if (!f.exists()) { f.mkdirs(); } return f; } public static void saveFile(String path, String name, byte[] data) throws IOException { File f = new File(path, name); if (f.exists()) { f.delete(); } FileOutputStream fos = null; try { fos = new FileOutputStream(f); fos.write(data); } finally { if (fos != null) { fos.flush(); fos.close(); } } } }